package com.tmxk.api.days01.yc;
/**
 * @description:
 * @author: yc
 * @date: 2022/11/28 14:02
 * @Version: 1.0
 **/
public class Dog implements Comparable{
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Dog() {
    }

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    @Override
    public int compareTo(Object o) {
        Dog dog = (Dog) o;
        return this.getAge() - dog.getAge();
    }
}
